//
//  StartMoneyFilterCell.m
//  Finance
//
//  Created by cheng xiang on 13-8-7.
//  Copyright (c) 2013年 cheng xiang. All rights reserved.
//

#import "StartMoneyFilterCell.h"

@implementation StartMoneyFilterCell

@synthesize startField = _startField, delegate = _delegate;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        self.textLabel.font = [UIFont boldSystemFontOfSize:15];
        
        _startField = [[UITextField alloc] initWithFrame:CGRectMake(110, 7, 90, 30)];
        UIImage *btnImage = [UIImage imageNamed:@"cellbtnbg.png"];
        [_startField setBackground:[btnImage resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)]];
        _startField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        _startField.font = [UIFont systemFontOfSize:14];
        _startField.returnKeyType = UIReturnKeyDone;
        _startField.textAlignment = NSTextAlignmentCenter;
        _startField.delegate = self;
        _startField.placeholder = @"0";
        [self addSubview:_startField];
    }
    return self;
}

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"TEXTFIELDEDITING" object:_startField];
}

- (void)textFieldDidEndEditing:(UITextField *)textField
{
    if ([_delegate respondsToSelector:@selector(textEditDone:forKey:)]) {
        [_delegate performSelector:@selector(textEditDone:forKey:)withObject:textField.text withObject:@"认购起点"];
    }
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
